using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using SCSFContrib.DemoWorkshop.Infrastructure.Interface;

namespace SCSFContrib.DemoWorkshop.Infrastructure.Module
{
	public partial class AboutPresenter : Presenter<IAboutView>
	{
		public readonly Color TitleColor = Color.DarkBlue;
		public readonly Font TitleFont = new Font("Tahoma", 9.25f, FontStyle.Bold | FontStyle.Underline);
		public readonly string TitleText = "Contributors";
		public readonly HorizontalAlignment TitleAlignment = HorizontalAlignment.Center;

		public readonly Color TextColor = Color.Black;
		public readonly Font TextFont = new Font("Tahoma", 8.25f, FontStyle.Regular);

		// taken from the 'People' tab of the SCSFContrib codeplex project - TODO config
		private readonly string[] Contributors = new[]	{ "gblock",	"kentcb", "matiaswoloski", "bklooste",
		                                              	  "bsimser", "ChrisHolmes", "ejadib", "erwintsai",
		                                              	  "ibaumann", "israelio", "jbe2277", "jonathan",
		                                              	  "mconverti", "nicklasv", "siacomuzzi", "PandaWood", 
														  "WardBell", "xclan"
		                                              	};
		/// <summary>
		/// This method is a placeholder that will be called by the view when it has been loaded.
		/// </summary>
		public override void OnViewReady()
		{
			base.OnViewReady();
			View.FillContributorsBox();
		}

		/// <summary>
		/// Close the view
		/// </summary>
		public void OnCloseView()
		{
			base.CloseView();
		}

		/// <summary>
		/// construct the list-of-contributors text for the view TODO - would like to create a small test for this, even it is a DemoApp
		/// </summary>
		public string CreateContributorText()
		{
			string contributorText = Environment.NewLine + Environment.NewLine;

			foreach (string contributor in Contributors)
				contributorText += contributor + Environment.NewLine;

			return contributorText.TrimEnd();
		}

		/// <summary>
		/// navigate the the SCSF website - ShellExecute ensures the default browser is used
		/// </summary>
		public void NavigateToWebSite()
		{
			var psi = new ProcessStartInfo(View.ScsfUrl) { UseShellExecute = true };
			Process.Start(psi);
		}
	}
}

